#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#

import time
from gevent import monkey, spawn; monkey.patch_all()
# import gevent
from threading import current_thread


def task1():
    print("task1")
    time.sleep(2)
    print(current_thread().name)
    return "hello world task1"


def task2():
    print("task2")
    time.sleep(3)
    return "hello world task2"


start = time.time()
g1 = spawn(task1)
g2 = spawn(task2)

g1.join()
g2.join()
stop = time.time()

print("master {}".format(stop - start))
print(g1.value)
print(g2.value)
